
import {INCREMENT, DECREMENT} from './constant'

const initState = 99 // 初始化状态


export default function countReducer(preState = initState, action) {
  const { type, data } = action
  switch (type) {
    // 如果是加
    case INCREMENT:
      return preState + data;
    // 如果是减
    case DECREMENT:
      return preState - data;
      
    default:
      return preState
  }
  
}